package com.yipao.core.mqtt.vo;

import com.alibaba.fastjson.JSONArray;
import com.yipao.core.util.UUIDUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author tianhao
 * @date 2020/6/8 22:32
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MqttSendVo implements java.io.Serializable {
    private long timestamp;
    private String messageId;
    private String deviceNo;
    private String affairId;
    private MqttSendMessage message;
    /**
     * 内容
     */
    private Object contents;

    public MqttSendVo(String deviceNo, Integer cmd, Integer ot) {
        this.timestamp = System.currentTimeMillis();
        this.messageId = UUIDUtil.randomUUID();
        this.deviceNo = deviceNo;
        this.message = new MqttSendMessage(cmd, ot, messageId);
    }

    public MqttSendVo(String deviceNo, Integer cmd, Integer ot, Object contents) {
        this.timestamp = System.currentTimeMillis();
        this.messageId = UUIDUtil.randomUUID();
        this.deviceNo = deviceNo;
        this.message = new MqttSendMessage(cmd, ot, messageId);
        this.contents = contents;
    }

    public MqttSendVo(String affairId,String deviceNo, Integer cmd, Integer ot, Object contents) {
        this.affairId=affairId;
        this.timestamp = System.currentTimeMillis();
        this.messageId = UUIDUtil.randomUUID();
        this.deviceNo = deviceNo;
        this.message = new MqttSendMessage(cmd, ot, messageId);
        this.contents = contents;
    }
}
